package com.yunshangwoniu.core.baseAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.yunshangwoniu.core.cache.CacheAble;

public class BaseAction extends ActionSupport
{
	private static final long serialVersionUID = -4459045258357795577L;
	private String callback; // 回掉url

	public HttpServletRequest getRequest()
	{
		return ServletActionContext.getRequest();
	}

	public HttpServletResponse getResponse()
	{
		return ServletActionContext.getResponse();
	}

	protected boolean isLogin(CacheAble<Object, Object> cache, HttpServletRequest request, String key, String cacheKey)
	{
		Object obj = cache.get(cacheKey);
		return  obj != null ? true : false;
	}

	public String getCallback()
	{
		return callback;
	}

	public void setCallback(String callback)
	{
		this.callback = callback;
	}

	public class LoginMsg
	{
		private String loginMsg;

		public String getLoginMsg()
		{
			return loginMsg;
		}
		public void setLoginMsg(String loginMsg)
		{
			this.loginMsg = loginMsg;
		}

		public LoginMsg(String loginMsg)
		{
			super();
			this.loginMsg = loginMsg;
		}

		public LoginMsg()
		{
			super();
		}
	}

}
